#include "nr_device_type_property.h"

nr_device_type_property::nr_device_type_property()
    : m_propery_type(nr_device_type_property::Invalid)
    , m_value_type(nr_object::Invalid)
    , m_id(NR_INVALID_ID)
{
}

nr_device_type_property::~nr_device_type_property()
{
}

nr_device_type_property::property_type_t nr_device_type_property::parse_property_type(const QString &type_str)
{
    const QString str_property_types[] =  {"Invalid",
        "Property",
        "PropertyGroup",
        "PropertyEnum",
        "PropertyEnumItem",
        "Parameter",
        "Event",
        "EventCategory"};

    for(int i = 0; i < NR_ARRAY_SIZE(str_property_types); ++i)
    {
        if (type_str.compare(str_property_types[i], Qt::CaseInsensitive) == 0)
        {
            return (property_type_t)i;
        }
    }

    return nr_device_type_property::Invalid;
}

QString nr_device_type_property::toString_property_type()
{
    const QString str_property_types[] =  {"Invalid",
        "Property",
        "PropertyGroup",
        "PropertyEnum",
        "PropertyEnumItem",
        "Parameter",
        "Event",
        "EventCategory"};

    property_type_t type = this->property_type();
    for(int i = 0; i < NR_ARRAY_SIZE(str_property_types); ++i)
    {
        if ( type == property_type_t(i) )
        {
            return str_property_types[i];
        }
    }
    return "";
}

QString nr_device_type_property::toString_value_type()
{
    const QString str_value_types[] = {"Invalid",
        "Bool",
        "Int",
        "UInt",
        "LongLong",
        "ULongLong",
        "Double",
        "Char",
        "Map",
        "List",
        "String",
        "StringList",
        "ByteArray",
        "BitArray",
        "Date",
        "Time",
        "DateTime",
        "Url",
        "Locale",
        "Rect",
        "RectF",
        "Size",
        "SizeF",
        "Line",
        "LineF",
        "Point",
        "PointF",
        "Hash"};

    nr_object::value_type_t type = this->value_type();
    for(int i = 0; i < NR_ARRAY_SIZE(str_value_types); ++i)
    {
        if ( type == nr_object::value_type_t(i) )
        {
            return str_value_types[i];
        }
    }

    return "";
}
